init()
{
	level thread onPlayerConnect();
}

onPlayerConnect()
{
	for(;;)
	{
		level waittill("connecting", player);
		
		// [BP] Allchat Enforcer
		player thread teamchat_enforcer();
	}
}

teamchat_enforcer()
{ 
	self endon("disconnect");
	
	timer = 7;
	
	while(1)
	{
		if(timer == 7)
		{
			level.allow_allchat = getcvarint("bp_allow_allchat");
			timer = 0;
			
			if(!level.allow_allchat) 
			{
				self setClientCvar("cg_teamchatsonly", 1); 
			} 
			else 
			{
				self setClientCvar("cg_teamchatsonly", 0);
			}
		}
		
		wait level.fps_multiplier * 0.5;
		timer = timer + .5;
	}
	
}